package com.telecom.oil.smart.controller.mini;

import com.telecom.oil.common.core.util.R;
import com.telecom.oil.common.security.annotation.Inner;
import com.telecom.oil.smart.service.SetRegionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mini/set/region")
@Tag(name = "微信小程序端-数字乡村行政区模块")
@Inner(value = false)
@RequiredArgsConstructor
public class MiniSetRegionController {

	private final SetRegionService setRegionService;

	@Operation(summary = "根据level获取行政区列表", description = "根据level获取行政区列表")
	@GetMapping("/list")
	public R getRegionListByLevelAndParentId(@RequestParam(value = "level") int level,
											 @RequestParam(value = "parentId") int parentId) {
		return R.ok(setRegionService.getRegionListByLevelAndParentId(level, parentId));
	}

}
